package com.heima.wemedia;

import org.checkerframework.checker.units.qual.C;
import org.joda.time.DateTime;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;

public class TestTTT {
    public static void main(String[] args) {
//        HashMap<String, Object> map = new HashMap<>();
//        map.put(null, "aaa");
//        map.put(null, "bbb");
//        System.out.println(map);
//        Hashtable<String, Object> hashtable = new Hashtable<>();//key和value都不允许为null
//        hashtable.put("abc",null);
//        System.out.println(hashtable);


        Calendar calendar = Calendar.getInstance();
        System.out.println(calendar.getTime());
        calendar.add(Calendar.DATE, -5);
        System.out.println(calendar.getTime());
        Date time = calendar.getTime();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(simpleDateFormat.format(time));


        Date date = DateTime.now().minusDays(5).toDate();
        System.out.println(date);


//        String s = LocalDateTime.now().minusDays(5).to
//        System.out.println(s);

        LocalDateTime localDateTime = LocalDateTime.now().minusDays(5);

        Date date1 = Date.from( localDateTime.atZone( ZoneId.systemDefault()).toInstant());

        System.out.println(date1);

    }
}
